HasCookie Method

Syntax

Context.Response.HasCookie as L (CookieName as C)

Arguments

CookieNameCharacter

The name of the cookie to look for.

Returns

existsLogical

Returns .T. if the cookie exists. Otherwise, returns .F..

Description

Tests if a cookie exists.

Discussion

The Context.Response.HasCookie method checks to see if CookieName exists. If the cookie exists, HasCookie returns .t., otherwise it returns .f..

Use Context.Response.GetCookie(CookieName) to get the cookie. Context.Response.GetCookie returns a System::Web::HttpCookie if the cookie exists. Otherwise, it returns a null value.

Example

dim cookieName as c
cookieName = "CustomCookie"
if Context.Response.HasCookie(cookieName) then
    ?"The cookie exists." + crlf()
    ?Context.Request.GetCookie(cookieName)
else
    ?"The cookie doesn't exist." + crlf()
end if

See Also